package com.yscp.ysdemo.constant;

import java.util.*;

//以某个相同的类型字段开头方便idea提示相同类别的常量
public final class Constants {
    private Constants(){};

    public  static final String  DATEFORMAT = "yyyy-MM-dd HH:mm:ss";   //日期格式
    public  static  final  int LIMITTAGS = 5;           //tags查询时显示多少条消息

    /*UserDto的code要用到这些状态码*/
    public  static  final int SUCCESS = 1;           //登录成功
    public  static  final int NAMENOTEXIST = 0;     //用户名不存在
    public  static  final int PASSWORDERROR  = -1;  //密码错误
    public static  final  int DISANBLEUSER = -2;

    public static final int USER_ENABLE_STATUS = 0; //用户可用
    public static final int USER_DISABLE_STATUS = -1; //用户涉及违规被封禁

//    user表的type
    public static final int ADMIN = 1;          //管理员类型
    public static final int USER = 0;           //普通用户类型

    //实体字段类型
    public static final int USER_TYPE = 0;  //用户对象类型
    public static final int POST_TYPE=1;    //帖子对象类型，区分点赞或评论的对象实体
    public static final int COMMENT_TYPE=2;     //评论对象类型，区分点赞或评论的对象实体
    public static final int TAG_TYPE=3;         //话题类型

    public static final  int PUST_PUBLICNOTICE = 2;

//    帖子类型的细分种类，对应帖子表postType字段
    public static final int POSTTYPE_POST = 1;      //普通帖子
    public static final int POSTTYPE_PUBLICNOTICE = 2;//官方推送公告


    public static final  int PUST_POST = 1; //推送首页贴
    public static final  int PUST_NOT_POST = 0;      //非推送贴



    public static final int COMMENT_LIMIT_OUT = 5;  //每次显示第一层帖子的数量
    public static final int COMMENT_LIMIT_IN = 10; //每次显示第二层帖子的数量


    public static final  int SEARCH_TAGLIMIT = 5; //官方推送公告
    public static final  int SEARCH_POSTLIMIT = 5; //推送首页贴
    public static final  int SEARCH_USERLIMIT = 5; //推送首页贴
    //user表性别
    public static final int SEX_MAN  = 1;       //性别男
    public static final int SEX_WOMAN  = 2;      //性别女
    public static final int SEX_SECRET  = 0;    //性别保密

    public static final int SHOWTYPE_HOT = 0;   //按热门排序搜索
    public static final int SHOWTYPE_NEWTIME = 1;  //按最新排序搜索
    public static final int SHOWTYPE_OLDTIME  = 2;  //按最早排序搜索
    public static final int SHOWTYPE_COMMENTNEW = 3; //按实体最新被评论时间排序

    public static final int TAG_PUSH_STATUS = 1;
    public static final int TAG_NOT_PUSH_STATUS = 0;

    //（点赞）like表的status状态
    public static final int LIKE_STATUS = 0;  //点赞状态
    public static final int LIKE_NOT_STATUS = -1;  //非点赞状态

    //（点赞）like表的status状态
    public static final int COLLECT_STATUS = 0;  //收藏状态
    public static final int COLLECT_NOT_STATUS = -1;  //非收藏状态

    //关注表（focus）的status字段
    public static final int FOCUS_STATUS = 0;  //关注状态
    public static final int FOCUS_NOT_STATUS = -1;  //非关注状态

    //图片上传存放的磁盘位置，使用绝对路径创建
    public static final String PATH_ROOT = "/imgBases";     //根目录文件夹路径
    public static final String PATH_HEADIMG = "/headImg/";  //根目录下的子目录,base64上传时，头像存放路径
    public static final String PATH_REALIMG = "/resetImg/"; //根目录下的子目录,无压缩图片存放路径
    public static final String PATH_POSTIMG = "/postImg/";  //根目录下的子目录,压缩图片存放路径

    //comment表的status字段
    public static final int COMMENT_SHOW_STATUS = 0;//正常显示状态
    public static final int COMMENT_SHOW_NOT_STATUS = -1;//不能显示状态
    public static final int COMMENT_TOP_STATUS = 1; //置顶状态

    //所有表的删除字段
    public static final int DELETED_STATUS = 1; //删除状态
    public static final int DELETED_NOT_STATUS = 0; //没有被删除状态

    public static final int IMG_MAXCOUNT = 2; //限制每个帖子简介的展示图片数量上限
    public static final int CONTENT_MAXCOUNT = 50;  //限制每个帖子简介展现文字的数量上限

    public static final int OPTION_KEEPVISITOR = -1;   //显示帖子的阀门值，表示保持游客状态执行业务
    public static final int OPTION_NOPTION = 0;       //显示帖子的阀门值，表示不用特殊处理
    public static final int OPTION_SAVEMSG = 1;     //表示需要将处理完的结果存到session域

    public static final int LIMIT_SHOWPOST = 5;  //限制每次加载的帖子简介的数量

    //配置类型
    public static final int CONFIGTYPE_PERSONALCENTER = 1; //个人中心配置类型
    public static final int CONFIGTYPE_SUBSCRIPTION = 2;    //订阅配置类型

    //个人中心系统默认配置
    public static  final Map DEFAULT_PERSONALCENTER = new HashMap();
    static {
        DEFAULT_PERSONALCENTER.put("showHome",true);
        DEFAULT_PERSONALCENTER.put("showPost",true);
        DEFAULT_PERSONALCENTER.put("showComment",true);
        DEFAULT_PERSONALCENTER.put("showCollect",true);
    }

    //消息中心系统默认配置,要转成json串
    public static  final Map DEFAULT_SUBSCRIPTION = new HashMap<>();
    static {
        DEFAULT_SUBSCRIPTION.put("comment",true);
        DEFAULT_SUBSCRIPTION.put("like",true);
        DEFAULT_SUBSCRIPTION.put("sysm",true);
    }
//    "{\"comment\":true,\"like\":true, 'sysm':true}";    //订阅配置

    public static final int PAGETYPE_TAVERN = 0;
    public static final int PAGETYPE_STRATEGY = 1;
    public static final int PAGETYPE_OFFICIAL = 2;
//
//    public static final List<String> TYPE_List = new ArrayList<>(Arrays.asList("酒馆","攻略","官方"));

    //type和对应字符串映射关系
    public static final Map<Integer,String> NAVLIST_MAP = new HashMap<>();
    static {
        NAVLIST_MAP.put(0,"酒馆");
        NAVLIST_MAP.put(1,"攻略");
        NAVLIST_MAP.put(2,"官方");
    }

//    不能被过滤的参数
    public static final List<String> PARAMS_PASE = new ArrayList<>(Arrays.asList("csrfToken","username","password","keyword","captchaMsg"));

    public static final List<String> SUPPOST_IMGTYPE = new ArrayList<>(Arrays.asList("webp","bmp","jpg","png","tif","jpeg")); //支持压缩的图片类型
    //public static final String BUFFER_IMG = ResourceBundle.getBundle("resources/path").getString("buffer_img");      //大文件缓存区，指定放在服务器的位置
  //  public static ThreadLocal<List<String>> CACHE_PATH = new ThreadLocal<>();
    // 存放每个用户在文本框插入的图片路径，方便后续提交时清理不需要的图片。其实这个还是一样搞不了，tomcat
    //是一次请求一个线程的，用线程是区分不了是不是同一个用户。非常难在这种情况下判断。其实定时处理图片即可
    //可以隔多少天之类的，把数据库保存的图片url比对存放图片的库，把垃圾图片从库里面删除即可
    public final static String LUCENE_PREAG = "<font style='color:#00c1fc'>";
    public  final  static String LUCENE_POSTTag = "</font>";

    //服务端的盐
    public static String SERVLETSALT = "qwerasfgjfs21q4";


    //    消息系统中的消息类型
    public  static final int NOTICE_ANNOUNCE  = 1;  //1: 公告 Announce
    public  static final int NOTICE_REMIND = 2;     //2: 提醒 Remind
    public  static final int NOTICE_MESSAGE = 3;    //3：信息 Message

    //    提醒关联的动作
    public static final int ACTION_LIKE  = 1;   //点赞
    public static final int ACTION_COMMENT = 2; //评论
    public static final  int ACTION_DELETE = 3; //当该实体不是该用户删除时，需要被提醒

    //用户不同的行为对应的默认订阅事件
    public static  final List<Integer> REASON_CREATE_POST = new ArrayList<>(Arrays.asList(ACTION_LIKE,ACTION_COMMENT,ACTION_DELETE)); //用户创建帖子之后，自动订阅对该帖子的点赞和评论事件
    public static  final List<Integer> REASON_CREATE_COMMENT = new ArrayList<>(Arrays.asList(ACTION_LIKE,ACTION_COMMENT,ACTION_DELETE)); //用户创建评论之后，自动订阅对该评论的点赞和评论事件



    public static  final  String URL_APPEAL = "/appeal";
//    public static  final List<String> REASON_CREATE_POST = new ArrayList<>(Arrays.asList("webp","bmp","jpg","png","tif","jpeg"));
//    public static  final List<String> REASON_CREATE_COMMENT = new ArrayList<>(Arrays.asList("webp","bmp","jpg","png","tif","jpeg"));
}
